# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-xtermcolor
pkgname=('python2-xtermcolor' 'python-xtermcolor')
_pkgname=xtermcolor
pkgver=1.3
pkgrel=10
pkgdesc='Python module for colorizing output with xterm 256 color support.'
arch=('any')
url='https://pypi.org/project/xtermcolor/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('6e1faa33182fe051bea5c497c6ecde1f123dcfd55358604e7271ea7f48bfe08f2c3069a9cf5ef0b1f9da7c2ba12367313aa5a5ca737d508d859244ebec7b6ec0')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-xtermcolor() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/xtermcolor" "$pkgdir/usr/bin/xtermcolor2"
}

package_python-xtermcolor() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

